1. Field of the Invention
The present invention relates to an input apparatus, and in particular, to a method for recognizing keys in a keypad or a keyboard of a key matrix structure.
2. Description of the Related Art
Most of the electronic products widely used these days such as computers, portable mobile terminals, etc. employ a keypad or a keyboard having a key matrix structure as a key input apparatus. A terminal control unit comprising a key input apparatus having a key matrix structure recognizes an input of a key by a user with a key interrupt technique or a polling technique. According to the polling technique, the terminal control unit checks if any change occurs in the key status in a predetermined cycle. According to the key interrupt technique, any change of a key status in a keypad or a keyboard is generated to a terminal control unit as a key interrupt, and the terminal control unit recognizes the key. When a key interrupt occurs, the control unit confirms the current key status by checking each bit of an inner register to learn a change in which key has generated the key interrupt. The control unit also confirms which key has been changed through comparison with the previous key status.
The following is a detailed description of a structure of a key matrix according to each bit, as shown in FIG. 2, as well as a construction of an inner register indicating a result of a key interrupt of a key matrix, as shown in FIG. 3. The examples of key matrix structures in FIGS. 2 and 3 have a key matrix structure of 5×5. Under the status of not pushing any keys on the key matrix (initial status), all the bits from b0 to b9 of the 10-bit inner register are “0”. This means that an output value of the key matrix is “00000 00000”. If the key in 0 line at 0 row on the key matrix, i.e., the key [0][0], is pushed by the user, a key interrupt occurs. The resultant output of the interrupt displayed on the 10-bit register is “00001 00001”, i.e., 0x21 (H) (H signifies hexa-decimal). To confirm pushing of the key [0][0] in 0 line at 0 row, the control unit checks which bit is “1” in each of the upper 5 bits and the lower 5 bits of the 10-bit inner register to confirm if the currently pushed key is key [0][0]. If the user pushes a key [1][1] under this status, the key interrupt value displayed in the 10-bit register by the key interrupt from the key matrix is 0x63 (H). The predictable keys having one bit when dividing the 10-bit register into the upper 5 bits and the lower 5 bits are key [0][0], key [0][1], key [1][0] and key [1][1]. If the user had previously pushed the key [0][0] and currently pushed the key [1][1], the control unit should logically compare the previous key status with the current key status to determine that the currently pushed key is key [1][1] among key [0][0], key [0][1], key [1][0] and key [1][1].